import './index.less';
import { truncate } from 'lodash';

const GoodsItem = (props) => {
  const { item, onClickPro } = props;

  const handleClick = (id) => {
    onClickPro(id)
    // console.log(id);
  }

  return (
    <div className="goods-item" onClick={() => { handleClick(item.goods_id) }}>
      <div className="left">
        <img src={item.goods_image} alt="" />
      </div>
      <div className="right">
        <p className="tit text-ellipsis-2">
          {truncate(item.goods_name, { length: 40 })}
        </p>
        <p className="count">已售{item.goods_sales}件</p>
        <p className="price">
          <span className="new">¥{item.goods_price_max}</span>
          <span className="old">¥{item.line_price_max}</span>
        </p>
      </div>
    </div>
  )
}

export default GoodsItem;